using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;

namespace Triton.Game
{
	public static class Interop
	{
		public delegate bool EnumThreadDelegate(IntPtr hWnd, IntPtr lParam);

		[CompilerGenerated]
		private sealed class Class245
		{
			public List<IntPtr> list_0;

			public EnumThreadDelegate enumThreadDelegate_0;

			internal bool method_0(IntPtr intptr_0, IntPtr intptr_1)
			{
				list_0.Add(intptr_0);
				return true;
			}
		}

		[DllImport("user32.dll")]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool GetCursorPos(out Point lpPoint);

		[DllImport("user32.dll", SetLastError = true)]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool GetWindowInfo(IntPtr hWnd, ref WindowInfoWin32 pwi);

		[DllImport("user32.dll", SetLastError = true)]
		internal static extern IntPtr FindWindow(string string_0, string string_1);

		[DllImport("user32.dll", SetLastError = true)]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool SetCursorPos(int x, int y);

		[DllImport("user32.dll")]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool PostMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);

		[DllImport("user32.dll")]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);

		[DllImport("kernel32.dll")]
		public static extern uint GetTickCount();

		[DllImport("user32.dll")]
		public static extern uint MapVirtualKeyW(uint uCode, uint uMapType);

		[DllImport("user32.dll")]
		[return: MarshalAs(UnmanagedType.Bool)]
		public static extern bool EnumThreadWindows(int dwThreadId, EnumThreadDelegate lpfn, IntPtr lParam);

		[DllImport("USER32.DLL", CharSet = CharSet.Unicode, ThrowOnUnmappableChar = true)]
		public static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);

		internal static IntPtr smethod_0(Process process_0, string string_0)
		{
			foreach (IntPtr item in smethod_1(process_0))
			{
				StringBuilder stringBuilder = new StringBuilder(1024);
				GetClassName(item, stringBuilder, stringBuilder.Capacity);
				if (stringBuilder.ToString() == string_0)
				{
					return item;
				}
			}
			return IntPtr.Zero;
		}

		internal static IEnumerable<IntPtr> smethod_1(Process process_0)
		{
			List<IntPtr> list_0 = new List<IntPtr>();
			foreach (ProcessThread thread in process_0.Threads)
			{
				EnumThreadWindows(thread.Id, delegate(IntPtr intptr_0, IntPtr intptr_1)
				{
					list_0.Add(intptr_0);
					return true;
				}, IntPtr.Zero);
			}
			return list_0;
		}

		public static char MapVirtualKeyW(Keys key)
		{
			return (char)MapVirtualKeyW((uint)key, 2u);
		}
	}
}
